package com.zoro.barn.business.service.system.business.menu.dao;

import com.zoro.barn.commons.db.annotations.MybatisMapper;
import com.zoro.barn.business.service.system.business.menu.entiity.BarnMenu;

import java.util.List;
import java.util.Set;

/**
 * @author zhaoxingwu
 */
@MybatisMapper
public interface BarnMenuMapper {

    /**
     * get all records
     *
     * @return result set
     */
    List<BarnMenu> getAll();

    /**
     * query by primary id
     *
     * @return data
     */
    BarnMenu getById(String pid);

    /**
     * insert a new data
     *
     * @param data new data
     */
    void insert(BarnMenu data);

    /**
     * update one data by pid
     *
     * @param data new data
     */
    void update(BarnMenu data);

    /**
     * delete one by pid
     *
     * @param pid pid
     */
    void delete(String pid);


    /**
     * delete all record who's parent id is {@code parentId}
     *
     * @param parentId parent_id
     */
    void deleteByParent(String parentId);


    /**
     * get one user's menus
     *
     * @param userId user id
     * @return menu
     */
    List<BarnMenu> getByUserId(String userId);

    /**
     * @param teamIds teams' id
     * @return result
     */
    List<BarnMenu> getByTeamIds(Set<String> teamIds);

}
